<%@ page import="java.text.NumberFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.nus.beans.User" %>
<%@ page import="java.util.List" %>
<%@ page import="com.nus.beans.UserType" %>
<%@ page import="org.apache.commons.lang3.StringEscapeUtils" %>
<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 9/21/12
  Time: 12:10 AM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>Create Project</title></head>
<%
    String errorMessage = (String) request.getAttribute("ERROR_MESSAGE");

%>
<body>
<table>
    <p>Create New Project</p>

    <form method="post" action="createProject.do">
    <tr>
        <td>Project Name:</td>
        <td><input type="text" name="projectName" maxlength="50"/></td>
    </tr>
    <tr>
        <td>Start Date:</td>
        <td><select name="startYear">
                <%for (int i = 2000; i < 2100; i++) {%>
                <option value="<%=i%>"><%=i%>
                </option>
                <%}%>
            </select>
                <select name="startMonth">
                    <%for (int j = 1; j < 13; j++) {%>
                    <option value="<%=j%>"><%=j%>
                    </option>
                    <%}%>
                </select>
                <select name="startDate">
                    <%for (int k = 1; k < 32; k++) {%>
                    <option value="<%=k%>"><%=k%>
                    </option>
                    <%}%>
                </select>
            </td>
    </tr>
   <tr>
        <td>Estimated End Date:</td>
        <td><select name="endYear">
                <%for (int i = 2000; i < 2100; i++) {%>
                <option value="<%=i%>"><%=i%>
                </option>
                <%}%>
            </select>
                <select name="endMonth">
                    <%for (int j = 1; j < 13; j++) {%>
                    <option value="<%=j%>"><%=j%>
                    </option>
                    <%}%>
                </select>
                <select name="endDate">
                    <%for (int k = 1; k < 32; k++) {%>
                    <option value="<%=k%>"><%=k%>
                    </option>
                    <%}%>
                </select>
            </td>
    </tr>
        <tr>
        <td>Deadline:</td>
        <td><select name="deadlineYear">
                <%for (int i = 2000; i < 2100; i++) {%>
                <option value="<%=i%>"><%=i%>
                </option>
                <%}%>
            </select>
                <select name="deadlineMonth">
                    <%for (int j = 1; j < 13; j++) {%>
                    <option value="<%=j%>"><%=j%>
                    </option>
                    <%}%>
                </select>
                <select name="deadlineDate">
                    <%for (int k = 1; k < 32; k++) {%>
                    <option value="<%=k%>"><%=k%>
                    </option>
                    <%}%>
                </select>
            </td>
    </tr>
        <tr><td>Select User:</td>
            <td><table>
                <% List<User> usersList = (List<User>) request.getAttribute("usersList");
                    for(User user : usersList){%>
                <tr><td><input type="checkbox" name="<%= "user_" + user.getUserId() %>" value="<%=user.getUserId()%>"/></td>
                    <td><%=StringEscapeUtils.escapeXml(user.getFirstName()) + " " + StringEscapeUtils.escapeXml(user.getLastName()) + "       " + user.getUserType().toString()%></td>
                </tr>
                <% } %>
            </table></td>
        </tr>
        <tr><td colspan="2">
            <% if(errorMessage != null){ %>
            <%= errorMessage %>
            <% } %>
        </td></tr>
    <input type="submit" value="Create"/>
    <a href="viewHome.do">Home</a>
    </form>
</table>

</body>
</html>